import { AudioOutlined } from '@ant-design/icons';
import React, { useEffect, useState } from 'react';
import { Input, Space } from 'antd';
const { Search } = Input;

const OnSearch = (
  <AudioOutlined
    style={{
      fontSize: 60,
      color: '#1677ff',
    }}
  />
);

const Searchs = ({ defaultText, idea }) => {
  console.log(defaultText);

  const [value, setValue] = useState(defaultText);

  useEffect(() => {
    setValue(defaultText);
  }, [defaultText]);

  return (
    <div style={{ padding: '22px' }}>
      <div style={{ display: 'flex', justifyContent: 'center' }}>
        <Space direction="vertical">
          <Search
            value={value}
            placeholder="区块高度、区块哈希"
            /* onSearch={onSearch} */
            onChange={(e) => {
              setValue(e.target.value);
            }}
            onSearch={() => idea(value)}
            style={{ width: 800 }}
          />
        </Space>
      </div>
    </div>
  );
};

export default Searchs;
